package addon.w3.w3x;

import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.image.BufferedImage;

public class TestMap2DView {
	static BufferedImage img;
	public static void main(String args[]) {
		try {
			W3XReader mapReader = new W3XReader("chaos.w3x");
			mapReader.parse();
			
			W3XDoodad doo = mapReader.getW3XDoodad();
    		W3XTreeData trees[]  = (W3XTreeData[])doo.get("tree");
    		
    		img = new BufferedImage(800, 800, BufferedImage.TYPE_INT_BGR);
    		for(int i=0;i<trees.length;i++) {
    			img.setRGB((int)trees[i].coordX/20+400, (int)trees[i].coordY/20+400, Color.GREEN.getRGB());
    		}
    		
			Frame frame = new Frame() {
				public void paint(Graphics g) {
					g.drawImage(img, 0, 0, this);
				}
			};
			frame.setSize(800,800);
			frame.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}